package com.study.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.study.dto.MyPage;
import com.study.dto.SchoolCounties;
import com.study.dto.Search;
import com.study.entity.Counties;
import com.study.entity.School;
import com.study.mapper.SchoolMapper;
import com.study.service.SchoolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author:zt
 * @createDate: 2022/6/20
 */
@Service
public class SchoolServiceImpl implements SchoolService {
    @Autowired
    private SchoolMapper schoolMapper;

    @Override
    public int deleteByPrimaryKey(Long schoolId) {
        return schoolMapper.deleteByPrimaryKey(schoolId);
    }

    @Override
    public int insert(School row) {
        return schoolMapper.insert(row);
    }

    @Override
    public int insertSelective(School row) {
        return schoolMapper.insertSelective(row);
    }

    @Override
    public School selectByPrimaryKey(Long schoolId) {
        return null;
    }

    @Override
    public int updateByPrimaryKeySelective(School row) {
        return schoolMapper.updateByPrimaryKeySelective(row);
    }

    @Override
    public int updateByPrimaryKeyWithBLOBs(School row) {
        return 0;
    }

    @Override
    public int updateByPrimaryKey(School row) {
        return 0;
    }

    @Override
    public MyPage<SchoolCounties> page(String countiesName, String schoolName) {
        PageInfo<SchoolCounties> objectPageInfo = PageHelper.startPage(1, 100).doSelectPageInfo(() -> {
            schoolMapper.page(countiesName,schoolName);
        });
        return new MyPage<SchoolCounties>().init(objectPageInfo);
    }

    @Override
    public List<School> selects(School school) {
        return null;
    }

    @Override
    public List<School> select() {
        return schoolMapper.select();
    }


}
